# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=vulmap
pkgver=95.a167c47
pkgrel=7
pkgdesc='Vulmap Online Local Vulnerability Scanners Project'
arch=('any')
groups=('blackarch' 'blackarch-scanner' 'blackarch-fingerprint'
        'blackarch-recon')
url='https://github.com/vulmon/Vulmap'
license=('GPL')
depends=('python' 'python-requests')
makedepends=('git')
source=("$pkgname::git+https://github.com/vulmon/Vulmap.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 755 -t "$pkgdir/usr/share/$pkgname" Vulmap-Linux/*.py
  install -Dm 644 -t "$pkgdir/usr/share/windows/$pkgname" Vulmap-Windows/*.ps1

  install -Dm 644 Vulmap-Linux/README.md \
    "$pkgdir/usr/share/doc/$pkgname/README-LNX.md"
  install -Dm 644 Vulmap-Windows/README.md \
    "$pkgdir/usr/share/doc/$pkgname/README-WIN.md"
  install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname-linux.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

